package com.zsy.controller;


import com.zsy.entity.User;
import com.zsy.service.IUserService;
import com.zsy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;
    //登陆
    @PostMapping("/login")
    public Result login(String phone,String password){
        System.out.println(phone);
        return userService.login(phone, password);
    }

    //注册
    @PostMapping("/register")
    public Result register(User user){
        return userService.register(user);
    }

    //获取验证码
    @PostMapping("sendCode")
    public Result sendCode(String phone){
        return userService.sendCode(phone);
    }
}
